package com.fone.player.play.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.fone.player.ApplicationManage;
import com.fone.player.R;
import com.fone.player.client.VgdetailRst;
import com.fone.player.play.fragment.VideoLiveCardFragment;
import com.fone.player.play.fragment.VideoRelatedFragment;

/**
 * 直播模式视频详情页适配器
 * 
 * @author kongxiaojun
 * @since 2014-4-21
 * 
 */
public class LiveModeAdapter extends FragmentStatePagerAdapter {

	private final int[] TITLES = { R.string.video_info_tab_card, R.string.video_info_tab_relate };
	private String linkurl;

	public LiveModeAdapter(FragmentManager fm, String linkurl) {
		super(fm);
		this.linkurl = linkurl;
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return ApplicationManage.getAplicationManageInstance().getString(TITLES[position]);
	}

	@Override
	public int getCount() {
		return TITLES.length;
	}

	@Override
	public Fragment getItem(int position) {
		if (position == 0) {
			return new VideoLiveCardFragment();
		} else {
			return VideoRelatedFragment.newInstances(linkurl);
		}
	}

	@Override
	public int getItemPosition(Object object) {
		return POSITION_NONE;
	}

}
